
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>3. 事件 · Harbinger</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="https://github.com/TeamCovertDragon/Harbinger/graphs/contributors">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-katex/katex.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-heimu/heimu.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../chapter-04/" />
    
    
    <link rel="prev" href="../chapter-02/build.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://covertdragon.team/" target="_blank" class="custom-link">TeamCovertDragon</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        <li class="header">总目录</li>
        
        
    

    
        
        <li class="header">前言</li>
        
        
    
        <li class="chapter " data-level="2.1" >
            
                <span>
            
                    
                    前言
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../">
            
                <a href="../">
            
                    
                    写在前面：这是什么？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../preface/">
            
                <a href="../preface/">
            
                    
                    序：《异教与隐士》
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">正文</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../chapter-01/">
            
                <a href="../chapter-01/">
            
                    
                    1. 站在巨人的肩膀上
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../chapter-01/mcp.html">
            
                <a href="../chapter-01/mcp.html">
            
                    
                    1.1 MCP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="../chapter-01/forge.html">
            
                <a href="../chapter-01/forge.html">
            
                    
                    1.2 Forge
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="../chapter-01/forgegradle.html">
            
                <a href="../chapter-01/forgegradle.html">
            
                    
                    1.3 ForgeGradle
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="../chapter-02/">
            
                <a href="../chapter-02/">
            
                    
                    2. 一切的开始
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.1" data-path="../chapter-02/metadata.html">
            
                <a href="../chapter-02/metadata.html">
            
                    
                    2.1 Mod 元数据
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.2" data-path="../chapter-02/build.html">
            
                <a href="../chapter-02/build.html">
            
                    
                    2.2 Mod 的构建与发布
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="3.3" data-path="./">
            
                <a href="./">
            
                    
                    3. 事件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="../chapter-04/">
            
                <a href="../chapter-04/">
            
                    
                    4. 物品
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.1" data-path="../chapter-04/item-stack.html">
            
                <a href="../chapter-04/item-stack.html">
            
                    
                    4.1 ItemStack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2" data-path="../chapter-04/advanced/">
            
                <a href="../chapter-04/advanced/">
            
                    
                    4.2 物品进阶
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.2.1" data-path="../chapter-04/advanced/meta-hack.html">
            
                <a href="../chapter-04/advanced/meta-hack.html">
            
                    
                    4.2.1 Meta-hack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2.2" data-path="../chapter-04/advanced/food.html">
            
                <a href="../chapter-04/advanced/food.html">
            
                    
                    4.2.2 食物
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2.3" data-path="../chapter-04/advanced/tool.html">
            
                <a href="../chapter-04/advanced/tool.html">
            
                    
                    4.2.3 工具及武器等
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2.4" data-path="../chapter-04/advanced/armor.html">
            
                <a href="../chapter-04/advanced/armor.html">
            
                    
                    4.2.4 护甲
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2.5" data-path="../chapter-04/advanced/throwable.html">
            
                <a href="../chapter-04/advanced/throwable.html">
            
                    
                    4.2.5 投掷物
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="../chapter-05/">
            
                <a href="../chapter-05/">
            
                    
                    5. 方块
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.5.1" data-path="../chapter-05/block-state.html">
            
                <a href="../chapter-05/block-state.html">
            
                    
                    5.1 方块状态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2" >
            
                <span>
            
                    
                    5.2 高级的方块
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.5.2.1" data-path="../chapter-05/advanced/ore.html">
            
                <a href="../chapter-05/advanced/ore.html">
            
                    
                    5.2.1 矿石
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2.2" data-path="../chapter-05/advanced/crop.html">
            
                <a href="../chapter-05/advanced/crop.html">
            
                    
                    5.2.2 作物
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2.3" data-path="../chapter-05/advanced/sapling.html">
            
                <a href="../chapter-05/advanced/sapling.html">
            
                    
                    5.2.3 树苗
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2.4" data-path="../chapter-05/advanced/redstone-sensitive.html">
            
                <a href="../chapter-05/advanced/redstone-sensitive.html">
            
                    
                    5.2.4 红石信号敏感的方块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2.5" data-path="../chapter-05/advanced/air-like.html">
            
                <a href="../chapter-05/advanced/air-like.html">
            
                    
                    5.2.5 类似空气的方块
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.5.3" data-path="../chapter-05/block-drop.html">
            
                <a href="../chapter-05/block-drop.html">
            
                    
                    5.3 掉落概论
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="../chapter-06/">
            
                <a href="../chapter-06/">
            
                    
                    6. 注册表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="../chapter-07/">
            
                <a href="../chapter-07/">
            
                    
                    7. 物理端、逻辑端与网络 IO
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.7.1" data-path="../chapter-07/tile-entity-sync.html">
            
                <a href="../chapter-07/tile-entity-sync.html">
            
                    
                    7.1 TileEntity 内建的解决方案
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.2" data-path="../chapter-07/entity-sync.html">
            
                <a href="../chapter-07/entity-sync.html">
            
                    
                    7.2 实体的解决方案
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.3" >
            
                <span>
            
                    
                    7.3 Forge 的扩展
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.7.3.1" data-path="../chapter-07/forge-extension/simple-network-wrapper.html">
            
                <a href="../chapter-07/forge-extension/simple-network-wrapper.html">
            
                    
                    7.3.1 SimpleNetworkWrapper
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.3.2" data-path="../chapter-07/forge-extension/fml-event-channel.html">
            
                <a href="../chapter-07/forge-extension/fml-event-channel.html">
            
                    
                    7.3.2 FMLEventChannel
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="../chapter-08/">
            
                <a href="../chapter-08/">
            
                    
                    8. 实体
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="../chapter-09/">
            
                <a href="../chapter-09/">
            
                    
                    9. 方块实体（TileEntity）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.9.1" data-path="../chapter-09/examples/">
            
                <a href="../chapter-09/examples/">
            
                    
                    9.1 实例
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.9.1.1" data-path="../chapter-09/examples/inventory.html">
            
                <a href="../chapter-09/examples/inventory.html">
            
                    
                    9.1.1 箱子，或别的种类的物品容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9.1.2" data-path="../chapter-09/examples/tank.md">
            
                <span>
            
                    
                    9.1.2 流体储罐
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9.1.3" data-path="../chapter-09/examples/grinder.md">
            
                <span>
            
                    
                    9.1.3 打粉机
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="../chapter-10/">
            
                <a href="../chapter-10/">
            
                    
                    10. 附魔
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="../chapter-11/">
            
                <a href="../chapter-11/">
            
                    
                    11. 渲染概论
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.11.1" data-path="../chapter-11/baked/">
            
                <a href="../chapter-11/baked/">
            
                    
                    11.1 方块及物品模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.11.1.1" data-path="../chapter-11/baked/custom-mesh.html">
            
                <a href="../chapter-11/baked/custom-mesh.html">
            
                    
                    11.1.1 自定义物品模型映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.1.2" data-path="../chapter-11/baked/tint.html">
            
                <a href="../chapter-11/baked/tint.html">
            
                    
                    11.1.2 染色
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.1.3" data-path="../chapter-11/baked/block-state-json.md">
            
                <span>
            
                    
                    11.1.3 方块状态映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.1.4" data-path="../chapter-11/baked/state-mapper.md">
            
                <span>
            
                    
                    11.1.4 IStateMapper
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.11.2" data-path="../chapter-11/custom-baked/">
            
                <a href="../chapter-11/custom-baked/">
            
                    
                    11.2 自定义模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.11.2.1" data-path="../chapter-11/custom-baked/baked.html">
            
                <a href="../chapter-11/custom-baked/baked.html">
            
                    
                    11.2.1 IBakedModel
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.2.2" data-path="../chapter-11/custom-baked/unbaked.html">
            
                <a href="../chapter-11/custom-baked/unbaked.html">
            
                    
                    11.2.2 IModel
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.2.3" data-path="../chapter-11/custom-baked/loader.html">
            
                <a href="../chapter-11/custom-baked/loader.html">
            
                    
                    11.2.3 ICustomModelLoader
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.2.4" data-path="../chapter-11/custom-baked/item-override.html">
            
                <a href="../chapter-11/custom-baked/item-override.html">
            
                    
                    11.2.4 ItemOverrideList
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.11.3" data-path="../chapter-11/entity-model/">
            
                <a href="../chapter-11/entity-model/">
            
                    
                    11.3 实体模型
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.11.3.1" data-path="../chapter-11/entity-model/encapsulated-model.html">
            
                <a href="../chapter-11/entity-model/encapsulated-model.html">
            
                    
                    11.3.1 ModelBase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.3.2" data-path="../chapter-11/entity-model/events.html">
            
                <a href="../chapter-11/entity-model/events.html">
            
                    
                    11.3.2 相关事件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.11.4" data-path="../chapter-11/tesr.html">
            
                <a href="../chapter-11/tesr.html">
            
                    
                    11.4 TESR
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.5" data-path="../chapter-11/render-layer.md">
            
                <span>
            
                    
                    11.5 Render Layer
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.6" data-path="../chapter-11/forge-extension/">
            
                <a href="../chapter-11/forge-extension/">
            
                    
                    11.6 Forge 的扩展
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.11.6.1" data-path="../chapter-11/forge-extension/forge-v1.html">
            
                <a href="../chapter-11/forge-extension/forge-v1.html">
            
                    
                    11.6.1 Forge BlockState V1
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.6.2" data-path="../chapter-11/forge-extension/other-format.html">
            
                <a href="../chapter-11/forge-extension/other-format.html">
            
                    
                    11.6.2 其他格式的模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.6.3" data-path="../chapter-11/forge-extension/fast-tesr.html">
            
                <a href="../chapter-11/forge-extension/fast-tesr.html">
            
                    
                    11.6.3 FastTESR
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.6.4" data-path="../chapter-11/forge-extension/animation.html">
            
                <a href="../chapter-11/forge-extension/animation.html">
            
                    
                    11.6.4 动画状态机
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11.6.5" data-path="../chapter-11/forge-extension/teisr.html">
            
                <a href="../chapter-11/forge-extension/teisr.html">
            
                    
                    11.6.5 TileEntityItemStackRenderer
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="../chapter-12/">
            
                <a href="../chapter-12/">
            
                    
                    12. 药水与状态效果
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.12.1" data-path="../chapter-12/potion.html">
            
                <a href="../chapter-12/potion.html">
            
                    
                    12.1 状态效果
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.12.2" data-path="../chapter-12/attributes-modifier.html">
            
                <a href="../chapter-12/attributes-modifier.html">
            
                    
                    12.2 状态效果与属性修饰符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.12.3" data-path="../chapter-12/potion-type.html">
            
                <a href="../chapter-12/potion-type.html">
            
                    
                    12.3 药水类型
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.13" data-path="../chapter-13/">
            
                <a href="../chapter-13/">
            
                    
                    13. 国际化与本地化
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.13.1" data-path="../chapter-13/text-component.html">
            
                <a href="../chapter-13/text-component.html">
            
                    
                    13.1 文本组件（ITextComponent）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.13.2" data-path="../chapter-13/note.html">
            
                <a href="../chapter-13/note.html">
            
                    
                    13.2 注意事项
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.14" data-path="../chapter-14/">
            
                <a href="../chapter-14/">
            
                    
                    14. 用户交互界面（GUI）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.14.1" data-path="../chapter-14/widget/index.md">
            
                <span>
            
                    
                    14.1 Widget
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.14.1.1" data-path="../chapter-14/widget/text-field.md">
            
                <span>
            
                    
                    14.1.1 文本输入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.14.1.2" data-path="../chapter-14/widget/button.md">
            
                <span>
            
                    
                    14.1.2 按钮
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.14.1.3" data-path="../chapter-14/widget/list.md">
            
                <span>
            
                    
                    14.1.3 列表
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.14.2" data-path="../chapter-14/main-screem/index.md">
            
                <span>
            
                    
                    14.2 游戏主界面与 HUD
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.14.3" data-path="../chapter-14/toast/index.md">
            
                <span>
            
                    
                    14.3 Toast
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.14.4" data-path="../chapter-14/container.md">
            
                <span>
            
                    
                    14.4 Container 与数据同步
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.15" data-path="../chapter-15/">
            
                <a href="../chapter-15/">
            
                    
                    15. 音效控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.16" data-path="../chapter-16/">
            
                <a href="../chapter-16/">
            
                    
                    16. 粒子效果
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.17" data-path="../chapter-17/">
            
                <a href="../chapter-17/">
            
                    
                    17. 资源包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.18" data-path="../chapter-18/">
            
                <a href="../chapter-18/">
            
                    
                    18. 用户输入
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.18.1" data-path="../chapter-18/keyboard.html">
            
                <a href="../chapter-18/keyboard.html">
            
                    
                    18.1 键盘输入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.18.2" data-path="../chapter-18/mouse.html">
            
                <a href="../chapter-18/mouse.html">
            
                    
                    18.2 鼠标输入
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.18.2.1" data-path="../chapter-18/mouse-in-gui.md">
            
                <span>
            
                    
                    18.2.1 GUI 中的鼠标控制
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.19" data-path="../chapter-19/">
            
                <a href="../chapter-19/">
            
                    
                    19. 世界生成与新维度
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.19.1" data-path="../chapter-19/world-gen-feature/">
            
                <a href="../chapter-19/world-gen-feature/">
            
                    
                    19.1 地图特性（Feature）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.19.1.1" data-path="../chapter-19/world-gen-feature/ore.html">
            
                <a href="../chapter-19/world-gen-feature/ore.html">
            
                    
                    19.1.1 矿石生成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.19.1.2" data-path="../chapter-19/world-gen-feature/retro-gen.md">
            
                <span>
            
                    
                    19.1.2 Retrogen
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.19.2" data-path="../chapter-19/biome/index.md">
            
                <span>
            
                    
                    19.2 生物群系（Biome）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.19.2.1" data-path="../chapter-19/biome/feature.md">
            
                <span>
            
                    
                    19.2.1 复用地图特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.19.2.2" data-path="../chapter-19/biome/decorator.md">
            
                <span>
            
                    
                    19.2.2 生物群系装饰器（Decorator）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.19.2.3" data-path="../chapter-19/biome/natural-spawn.md">
            
                <span>
            
                    
                    19.2.3 刷新生物
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.19.2.4" data-path="../chapter-19/biome/flower-entry.md">
            
                <span>
            
                    
                    19.2.3 附加篇：关于骨粉
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.19.3" data-path="../chapter-19/structure/index.md">
            
                <span>
            
                    
                    19.3 大型结构
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.19.3.1" data-path="../chapter-19/structure/base.md">
            
                <span>
            
                    
                    19.3.1 MapGenBase
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.19.3.2" data-path="../chapter-19/structure/structure.md">
            
                <span>
            
                    
                    19.3.2 MapGenStructure
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.19.3.3" data-path="../chapter-19/structure/template.md">
            
                <span>
            
                    
                    19.3.3 Template
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.19.4" data-path="../chapter-19/dimension/">
            
                <a href="../chapter-19/dimension/">
            
                    
                    19.4 新维度
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.19.4.1" data-path="../chapter-19/dimension/type.md">
            
                <span>
            
                    
                    19.4.1  可选的 WorldType
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.19.4.2" data-path="../chapter-19/dimension/dimension.md">
            
                <span>
            
                    
                    19.4.2 WorldProvider
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.19.4.3" data-path="../chapter-19/dimension/chunk-gen.md">
            
                <span>
            
                    
                    19.4.3 IChunkGenerator
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.19.4.4" data-path="../chapter-19/dimension/biome-gen.md">
            
                <span>
            
                    
                    19.4.4 BiomeProvider
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.20" data-path="../chapter-20/">
            
                <a href="../chapter-20/">
            
                    
                    20. 村庄
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.20.1" data-path="../chapter-20/villager-profession.html">
            
                <a href="../chapter-20/villager-profession.html">
            
                    
                    20.1 村民职业
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.20.2" data-path="../chapter-20/village-structure.md">
            
                <span>
            
                    
                    20.2 村庄结构
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.21" data-path="../chapter-21/">
            
                <a href="../chapter-21/">
            
                    
                    21. 合成表
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.21.1" data-path="../chapter-21/forge-extension/">
            
                <a href="../chapter-21/forge-extension/">
            
                    
                    21.1 Forge 的扩展
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.21.1.1" data-path="../chapter-21/forge-extension/ore-dictionary.html">
            
                <a href="../chapter-21/forge-extension/ore-dictionary.html">
            
                    
                    21.1.1 矿物词典（Ore Dictionary）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.21.1.2" data-path="../chapter-21/forge-extension/condition.html">
            
                <a href="../chapter-21/forge-extension/condition.html">
            
                    
                    21.1.2 IConditionFactory
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.21.1.3" data-path="../chapter-21/forge-extension/ingredient-factory.html">
            
                <a href="../chapter-21/forge-extension/ingredient-factory.html">
            
                    
                    21.1.3 IIngredientFactory
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.21.1.4" data-path="../chapter-21/forge-extension/recipe-factory.html">
            
                <a href="../chapter-21/forge-extension/recipe-factory.html">
            
                    
                    21.1.4 IRecipeFactory
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.21.1.5" data-path="../chapter-21/forge-extension/constants.html">
            
                <a href="../chapter-21/forge-extension/constants.html">
            
                    
                    21.1.5 常量池（_constants.json）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.21.2" data-path="../chapter-21/custom-recipe.md">
            
                <span>
            
                    
                    21.2 重新实现 IRecipe
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.21.3" data-path="../chapter-21/vanilla-furnace.html">
            
                <a href="../chapter-21/vanilla-furnace.html">
            
                    
                    21.3 扩展篇：熔炉配方及燃料值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.21.4" data-path="../chapter-21/vanilla-brewing-stand.html">
            
                <a href="../chapter-21/vanilla-brewing-stand.html">
            
                    
                    21.4 扩展篇：酿造台配方
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.21.5" data-path="../chapter-21/forge-extension/anvil-events.html">
            
                <a href="../chapter-21/forge-extension/anvil-events.html">
            
                    
                    21.5 扩展篇：铁砧“配方”
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.22" data-path="../chapter-22/">
            
                <a href="../chapter-22/">
            
                    
                    22. 进度（Advancement）
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.22.1" data-path="../chapter-22/forge-extension/custom-criterion.html">
            
                <a href="../chapter-22/forge-extension/custom-criterion.html">
            
                    
                    22.1 自定义进度触发条件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.22.2" data-path="../chapter-22/forge-extension/custom-item-predicates.html">
            
                <a href="../chapter-22/forge-extension/custom-item-predicates.html">
            
                    
                    22.2 自定义 Item Predicate
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.23" data-path="../chapter-23/">
            
                <a href="../chapter-23/">
            
                    
                    23. 战利品表
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.23.1" data-path="../chapter-23/condition.html">
            
                <a href="../chapter-23/condition.html">
            
                    
                    23.1 战利品表条件（Loot Condition）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.23.2" data-path="../chapter-23/function.html">
            
                <a href="../chapter-23/function.html">
            
                    
                    23.2 战利品表函数（Loot Function）
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.24" data-path="../chapter-24/">
            
                <a href="../chapter-24/">
            
                    
                    24. 命令
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.24.1" data-path="../chapter-24/function.html">
            
                <a href="../chapter-24/function.html">
            
                    
                    24.1 函数（.mcfunction）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.24.2" data-path="../chapter-24/command-tree.html">
            
                <a href="../chapter-24/command-tree.html">
            
                    
                    24.2 Forge 的扩展：CommandTreeBase
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.25" data-path="../chapter-25/">
            
                <a href="../chapter-25/">
            
                    
                    25. Forge 权限系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.25.1" data-path="../chapter-25/permission-handler.html">
            
                <a href="../chapter-25/permission-handler.html">
            
                    
                    25.1 IPermissionHandler
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.26" data-path="../chapter-26/">
            
                <a href="../chapter-26/">
            
                    
                    26. Forge 配置文件系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.26.1" data-path="../chapter-26/config-gui.html">
            
                <a href="../chapter-26/config-gui.html">
            
                    
                    26.1 Forge 可视化配置文件编辑界面
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.26.2" data-path="../chapter-25/raw-config.md">
            
                <span>
            
                    
                    26.2 Configuration 类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.26.3" data-path="../chapter-26/sync.html">
            
                <a href="../chapter-26/sync.html">
            
                    
                    26.3 同步配置文件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.27" data-path="../chapter-27/">
            
                <a href="../chapter-27/">
            
                    
                    27. Forge 流体系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.27.1" data-path="../chapter-27/fluid-stack.html">
            
                <a href="../chapter-27/fluid-stack.html">
            
                    
                    27.1 Fluid 与 FluidStack
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.27.2" data-path="../chapter-27/block.html">
            
                <a href="../chapter-27/block.html">
            
                    
                    27.2 流体方块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.27.3" data-path="../chapter-27/container/">
            
                <a href="../chapter-27/container/">
            
                    
                    27.3 流体容器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.27.3.1" data-path="../chapter-27/container/item.html">
            
                <a href="../chapter-27/container/item.html">
            
                    
                    27.3.1 物品形式的容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.27.3.2" data-path="../chapter-27/container/block.html">
            
                <a href="../chapter-27/container/block.html">
            
                    
                    27.3.2 方块形式的容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.27.3.3" data-path="../chapter-27/container/interaction.html">
            
                <a href="../chapter-27/container/interaction.html">
            
                    
                    27.3.3 流体容器之间的交互
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.27.4" data-path="../chapter-27/render.html">
            
                <a href="../chapter-27/render.html">
            
                    
                    27.4 流体渲染相关
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.28" data-path="../chapter-28/">
            
                <a href="../chapter-28/">
            
                    
                    28. Forge Capability 系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.28.1" data-path="../chapter-28/built-in/">
            
                <a href="../chapter-28/built-in/">
            
                    
                    28.1 Forge 内建的 Capability
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.28.1.1" data-path="../chapter-28/built-in/item.html">
            
                <a href="../chapter-28/built-in/item.html">
            
                    
                    28.1.1 IItemHandler
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.28.1.2" data-path="../chapter-28/built-in/fluid.html">
            
                <a href="../chapter-28/built-in/fluid.html">
            
                    
                    28.2.2 IFluidHandler, IFluidHandlerItem
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.28.1.3" data-path="../chapter-28/built-in/energy.html">
            
                <a href="../chapter-28/built-in/energy.html">
            
                    
                    28.2.3 IEnergyStorage
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.28.1.4" data-path="../chapter-28/built-in/animation.html">
            
                <a href="../chapter-28/built-in/animation.html">
            
                    
                    28.2.4 IAnimation
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.28.2" data-path="../chapter-28/custom.md">
            
                <span>
            
                    
                    28.2 属于你自己的第一个 Capability
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.29" data-path="../chapter-29/">
            
                <a href="../chapter-29/">
            
                    
                    29. 跨 Mod 兼容及 Add-on 制作
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.29.1" data-path="../chapter-29/imc.html">
            
                <a href="../chapter-29/imc.html">
            
                    
                    29.1 跨 Mod 通信（Inter-Mod Communication，IMC）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.29.2" data-path="../chapter-29/foreign-capabilities.html">
            
                <a href="../chapter-29/foreign-capabilities.html">
            
                    
                    29.2 使用第三方 Capability
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.30" >
            
                <span>
            
                    
                    30.
            
                </span>
            

            
        </li>
    

    
        
        <li class="header">附录</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../chapter-31/">
            
                <a href="../chapter-31/">
            
                    
                    31. 附录 I：相关开发资源
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../chapter-32/index.md">
            
                <span>
            
                    
                    32. 附录 II：？？？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../chapter-33/index.md">
            
                <span>
            
                    
                    33. 附录 III：？？？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="../chapter-34/index.md">
            
                <span>
            
                    
                    34. 附录 IV：？？？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="../chapter-35/index.md">
            
                <span>
            
                    
                    35. 附录 V：？？？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="../chapter-36/index.md">
            
                <span>
            
                    
                    36. 附录 VI：？？？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="../chapter-37/index.md">
            
                <span>
            
                    
                    37. 附录 VII：？？？
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="../chapter-38/index.md">
            
                <span>
            
                    
                    38. 附录 VIII：？？？
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">实战</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../chapter-39/index.md">
            
                <span>
            
                    
                    39. 实战（上）
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../chapter-40/index.md">
            
                <span>
            
                    
                    40. 实战（下）
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">后记</li>
        
        
    
        <li class="chapter " data-level="6.1" >
            
                <span>
            
                    
                    后记
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1.1" data-path="../afterword/index.md">
            
                <span>
            
                    
                    跋：《Aboard Harbinger Gunship》
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.2" data-path="../afterword/credits.md">
            
                <span>
            
                    
                    写在后面：鸣谢名单
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.1.3" data-path="../afterword/bibliography.md">
            
                <span>
            
                    
                    参考书目
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >3. 事件</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#&#x4E8B;&#x4EF6;&#x6982;&#x8BBA;"><b>1. </b>&#x4E8B;&#x4EF6;&#x6982;&#x8BBA;</a></li><ul><li><span class="title-icon "></span><a href="#&#x4EC0;&#x4E48;&#x662F;&#x4E8B;&#x4EF6;&#xFF1F;"><b>1.1. </b>&#x4EC0;&#x4E48;&#x662F;&#x4E8B;&#x4EF6;&#xFF1F;</a></li><li><span class="title-icon "></span><a href="#minecraft-&#x6CA1;&#x6709;&#x4E8B;&#x4EF6;&#x7CFB;&#x7EDF;"><b>1.2. </b>Minecraft &#x6CA1;&#x6709;&#x4E8B;&#x4EF6;&#x7CFB;&#x7EDF;</a></li><li><span class="title-icon "></span><a href="#&#x4E8B;&#x4EF6;&#x8BA2;&#x9605;"><b>1.3. </b>&#x4E8B;&#x4EF6;&#x8BA2;&#x9605;</a></li><li><span class="title-icon "></span><a href="#&#x81EA;&#x52A8;&#x6CE8;&#x518C;"><b>1.4. </b>&#x81EA;&#x52A8;&#x6CE8;&#x518C;</a></li><li><span class="title-icon "></span><a href="#&#x4E8B;&#x4EF6;&#x7684;&#x53D6;&#x6D88;&#x4E0E;&#x7ED3;&#x679C;"><b>1.5. </b>&#x4E8B;&#x4EF6;&#x7684;&#x53D6;&#x6D88;&#x4E0E;&#x7ED3;&#x679C;</a></li><li><span class="title-icon "></span><a href="#&#x4F18;&#x5148;&#x7EA7;"><b>1.6. </b>&#x4F18;&#x5148;&#x7EA7;</a></li><li><span class="title-icon "></span><a href="#&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6211;&#x9700;&#x8981;&#x7684;&#x4E8B;&#x4EF6;&#x600E;&#x4E48;&#x529E;&#xFF1F;"><b>1.7. </b>&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6211;&#x9700;&#x8981;&#x7684;&#x4E8B;&#x4EF6;&#x600E;&#x4E48;&#x529E;&#xFF1F;</a></li><li><span class="title-icon "></span><a href="#&#x4F46;&#x662F;&#x6211;&#x9700;&#x8981;&#x7ED9;&#x81EA;&#x5DF1;&#x7684;&#x3010;&#x67D0;&#x79CD;&#x673A;&#x5236;&#x3011;&#x5F04;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#xFF01;"><b>1.8. </b>&#x4F46;&#x662F;&#x6211;&#x9700;&#x8981;&#x7ED9;&#x81EA;&#x5DF1;&#x7684;&#x3010;&#x67D0;&#x79CD;&#x673A;&#x5236;&#x3011;&#x5F04;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#xFF01;</a></li></ul></ul></div><a href="#&#x4E8B;&#x4EF6;&#x6982;&#x8BBA;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="&#x4E8B;&#x4EF6;&#x6982;&#x8BBA;"><a name="&#x4E8B;&#x4EF6;&#x6982;&#x8BBA;" class="anchor-navigation-ex-anchor" href="#&#x4E8B;&#x4EF6;&#x6982;&#x8BBA;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x4E8B;&#x4EF6;&#x6982;&#x8BBA;</h1>
<h2 id="&#x4EC0;&#x4E48;&#x662F;&#x4E8B;&#x4EF6;&#xFF1F;"><a name="&#x4EC0;&#x4E48;&#x662F;&#x4E8B;&#x4EF6;&#xFF1F;" class="anchor-navigation-ex-anchor" href="#&#x4EC0;&#x4E48;&#x662F;&#x4E8B;&#x4EF6;&#xFF1F;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. &#x4EC0;&#x4E48;&#x662F;&#x4E8B;&#x4EF6;&#xFF1F;</h2>
<p>&#x4E8B;&#x4EF6;&#x662F;&#x4EC0;&#x4E48;&#xFF1F;&#x67D0;&#x4E2A;&#x65F6;&#x95F4;&#x70B9;&#x53D1;&#x751F;&#x7684;&#x6709;&#x4E00;&#x5B9A;&#x5173;&#x6CE8;&#x5EA6;&#x7684;&#x201C;&#x4E8B;&#x60C5;&#x201D;&#x3002;</p>
<p>&#x8003;&#x8651;&#x4E0B;&#x9762;&#x7684;&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-java">Teacher teacher = aCertainClass.getInstructor();
teacher.post(homework);
</code></pre>
<p>&#x6559;&#x5E08;&#x53D1;&#x5E03;&#x4E86;&#x4F5C;&#x4E1A;&#x3002;&#x4E00;&#x4E2A;&#x5305;&#x542B;&#x6709;&#x82E5;&#x5E72;&#x201C;&#x4F5C;&#x4E1A;&#x201D;&#x5BF9;&#x8C61;&#x7684; <code>List</code> &#x5206;&#x6D3E;&#x5230;&#x4E86;&#x5B66;&#x751F;&#x624B;&#x4E2D;&#x3002;<br>&#x8868;&#x9762;&#x4E0A;&#xFF0C;&#x5230;&#x6B64;&#x4E3A;&#x6B62;&#x4E86;&#x3002;&#x4E8B;&#x5B9E;&#x4E0A;&#xFF0C;&#x679C;&#x771F;&#x53EA;&#x80FD;&#x6709;&#x8FD9;&#x70B9;&#x903B;&#x8F91;&#x5417;&#xFF1F;&#x53D1;&#x5E03;&#x4F5C;&#x4E1A;&#x7684;&#x8FC7;&#x7A0B;&#x4E2D;&#x96BE;&#x9053;&#x4E0D;&#x4F1A;&#x53D1;&#x751F;&#x4EC0;&#x4E48;&#x4E8B;&#x60C5;&#x5417;&#xFF1F;&#x6BD4;&#x65B9;&#x8BF4;&#xFF0C;&#x6559;&#x5E08;&#x662F;&#x6709;&#x8BFE;&#x4EE3;&#x8868;&#x7684;&#xFF1A;</p>
<pre><code class="lang-java">studentRepresentative = teacher.getRepresentative();
homeworkList = homework.content();
<span class="hljs-keyword">for</span> (entry : homeworkList) {
    <span class="hljs-keyword">if</span> (!studentRepresentative.validate(singleHomework)) {
        studentRepresentative.broadcast(<span class="hljs-string">&quot;This homework has problem, please notify {} to fix it!&quot;</span>, teacher);
    }
}
</code></pre>
<p>&#x518D;&#x6BD4;&#x5982;&#x8BF4;&#xFF0C;&#x6709;&#x522B;&#x7684;&#x8001;&#x5E08;&#x4F1A;&#x5173;&#x5FC3;&#x522B;&#x7684;&#x8001;&#x5E08;&#x7684;&#x4F5C;&#x4E1A;&#xFF0C;&#x7136;&#x540E;&#x5FFD;&#x7136;&#x51B3;&#x5B9A;&#x201C;&#x4ECA;&#x5929;&#x5C31;&#x5C11;&#x5E03;&#x7F6E;&#x4E00;&#x70B9;&#x4F5C;&#x4E1A;&#x5427;&#x201D;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-keyword">if</span> (homeworkList.content().size() &gt; THRESHOLD) {
    myProposedHomework = myProposedHomework.subList(<span class="hljs-number">1</span>, <span class="hljs-number">3</span>);
}
</code></pre>
<h2 id="minecraft-&#x6CA1;&#x6709;&#x4E8B;&#x4EF6;&#x7CFB;&#x7EDF;"><a name="minecraft-&#x6CA1;&#x6709;&#x4E8B;&#x4EF6;&#x7CFB;&#x7EDF;" class="anchor-navigation-ex-anchor" href="#minecraft-&#x6CA1;&#x6709;&#x4E8B;&#x4EF6;&#x7CFB;&#x7EDF;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. Minecraft &#x6CA1;&#x6709;&#x4E8B;&#x4EF6;&#x7CFB;&#x7EDF;</h2>
<p>&#x56DE;&#x5230; Minecraft &#x4E0A;&#x6765;&#x2014;&#x2014;Modder &#x6709;&#x65F6;&#x5019;&#x5E0C;&#x671B;&#x80FD;&#x5E72;&#x6D89;&#x539F;&#x7248;&#x7684;&#x673A;&#x5236;&#x3002;&#x95EE;&#x9898;&#x6765;&#x4E86;&#xFF0C;&#x600E;&#x4E48;&#x5E72;&#x6D89;&#xFF1F;&#x539F;&#x7248;&#x7684;&#x4EE3;&#x7801;&#x5F88;&#x591A;&#x5730;&#x65B9;&#x90FD;&#x662F;&#x5199;&#x6B7B;&#x7684;&#xFF0C;&#x5BF9;&#x4E8E;&#x8FD9;&#x4E9B;&#x5730;&#x65B9;&#x6765;&#x8BF4;&#x6CA1;&#x4EC0;&#x4E48;&#x529E;&#x6CD5;&#x3002;<br>&#x4E3E;&#x4E2A;&#x4F8B;&#x5B50;&#xFF0C;&#x6211;&#x60F3;&#x5728;&#x73A9;&#x5BB6;&#x8FDB;&#x5165;&#x6E38;&#x620F;&#x65F6;&#x53D1;&#x51FA;&#x6B22;&#x8FCE;&#x8BCD;&#xFF0C;&#x600E;&#x4E48;&#x529E;&#xFF1F;&#x539F;&#x7248;&#x662F;&#x6709;&#x90A3;&#x4E48;&#x4E00;&#x53E5;&#x8BDD;&#x4F46;&#x90A3;&#x663E;&#x7136;&#x662F;&#x5199;&#x6B7B;&#x7684;&#x3002;</p>
<p>Forge &#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x5B8C;&#x5584;&#x7684;&#x4E8B;&#x4EF6;&#x7CFB;&#x7EDF;&#x6765;&#x89E3;&#x51B3;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#x3002;&#x76EE;&#x524D;&#xFF0C;Forge &#x6709;&#x4E09;&#x6761;&#x4E8B;&#x4EF6;&#x603B;&#x7EBF;&#xFF0C;&#x5206;&#x522B;&#x7528;&#x4E8E;&#x53D1;&#x5E03;&#x4E0D;&#x540C;&#x7C7B;&#x578B;&#x7684;&#x4E8B;&#x4EF6;&#xFF1A;</p>
<ul>
<li>&#x4E00;&#x822C;&#x4E8B;&#x4EF6;&#x603B;&#x7EBF;&#xFF08;<code>MinecraftForge.EVENT_BUS</code>&#xFF09;</li>
<li>&#x77FF;&#x7269;&#x751F;&#x6210;&#x603B;&#x7EBF;&#xFF08;<code>MinecraftForge.ORE_GEN_BUS</code>&#xFF09;</li>
<li>&#x5730;&#x5F62;&#x751F;&#x6210;&#x603B;&#x7EBF;&#xFF08;<code>MinecraftForge.TERRAIN_GEN_BUS</code>&#xFF09;</li>
</ul>
<p>&#x6CE8;&#x610F;&#xFF0C;FML &#x7684;&#x90A3;&#x51E0;&#x4E2A;&#x7528;&#x4E8E; Mod &#x52A0;&#x8F7D;&#x7684;&#x4E8B;&#x4EF6;&#x4E0D;&#x7B97;&#x3002;&#x90A3;&#x4E9B;&#x662F; Mod &#x52A0;&#x8F7D;&#x5468;&#x671F;&#x7684;&#x4E8B;&#x4EF6;&#xFF0C;&#x5728;&#x90A3;&#x4E2A;&#x65F6;&#x5019; FML &#x9700;&#x8981;&#x4F7F;&#x7528;&#x522B;&#x7684;&#x4E8B;&#x4EF6;&#x603B;&#x7EBF;&#xFF08;&#x5177;&#x4F53;&#x6765;&#x8BF4;&#xFF0C;&#x662F; Guava &#x7684;&#x4E8B;&#x4EF6;&#x603B;&#x7EBF;&#xFF09;&#x3002;</p>
<h2 id="&#x4E8B;&#x4EF6;&#x8BA2;&#x9605;"><a name="&#x4E8B;&#x4EF6;&#x8BA2;&#x9605;" class="anchor-navigation-ex-anchor" href="#&#x4E8B;&#x4EF6;&#x8BA2;&#x9605;"><i class="fa fa-link" aria-hidden="true"></i></a>1.3. &#x4E8B;&#x4EF6;&#x8BA2;&#x9605;</h2>
<p>&#x6309;&#x5982;&#x4E0B;&#x6B65;&#x9AA4;&#x64CD;&#x4F5C;&#xFF1A;</p>
<ol>
<li>&#x786E;&#x5B9A;&#x9700;&#x6C42;&#xFF0C;&#x7136;&#x540E;&#x627E;&#x4E8B;&#x4EF6;</li>
<li>&#x5982;&#x679C;&#x627E;&#x5230;&#x4E86;&#x5BF9;&#x5E94;&#x7684;&#x4E8B;&#x4EF6;&#xFF1A;</li>
</ol>
<pre><code class="lang-java"><span class="hljs-comment">// &#x672C;&#x65B9;&#x6CD5;&#x8FD4;&#x56DE;&#x503C;&#x5FC5;&#x987B;&#x662F; void</span>
<span class="hljs-comment">// &#x672C;&#x65B9;&#x6CD5;&#x7684;&#x53C2;&#x6570;&#x5FC5;&#x987B;&#x662F;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#xFF0C;&#x5E76;&#x4E14;&#x4F5C;&#x4E3A;&#x552F;&#x4E00;&#x7684;&#x53C2;&#x6570;&#x5B58;&#x5728;</span>
<span class="hljs-comment">// &#x672C;&#x65B9;&#x6CD5;&#x53EF;&#x4EE5;&#x4E0D;&#x662F;&#x9759;&#x6001;&#x7684;&#xFF0C;&#x5177;&#x4F53;&#x5DEE;&#x522B;&#x4E00;&#x4F1A;&#x5C31;&#x4F1A;&#x51FA;&#x73B0;</span>
<span class="hljs-meta">@SubscribeEvent</span>
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onEventFired</span><span class="hljs-params">(ARandomEvent event)</span> </span>{
    <span class="hljs-comment">// &#x5F53;&#x7136;&#x8FD9;&#x4E2A; ARandomEvent &#x4E00;&#x5B9A;&#x8981;&#x6362;&#x6210;&#x67D0;&#x4E2A;&#x771F;&#x5B9E;&#x5B58;&#x5728;&#x7684;&#x4E8B;&#x4EF6;&#x3002;</span>
}

<span class="hljs-comment">// &#x7136;&#x540E;&#x6CE8;&#x518C;</span>
MinecraftForge.EVENT_BUS.register(EventListener.class);

<span class="hljs-comment">// &#x5982;&#x679C;&#x76D1;&#x542C;&#x65B9;&#x6CD5;&#x4E0D;&#x4F7F;&#x7528; static&#xFF0C;&#x5219;&#x5E94;&#x4F7F;&#x7528;&#x5BF9;&#x5E94;&#x7C7B;&#x7684;&#x5B9E;&#x4F8B;</span>
MinecraftForge.EVENT_BUS.register(<span class="hljs-keyword">new</span> EventListener());
</code></pre>
<p>&#x4EE5;&#x53CA;&#x6CE8;&#x610F;&#x4E00;&#x70B9;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x8BA2;&#x9605;&#x7684;&#x4E8B;&#x4EF6;&#x5C5E;&#x4E8E;&#x77FF;&#x7269;&#x751F;&#x6210;&#x7C7B;&#x7684;&#xFF0C;&#x6216;&#x662F;&#x5730;&#x5F62;&#x751F;&#x6210;&#x7C7B;&#x7684;&#xFF08;&#x6BD4;&#x5982;&#x4EC0;&#x4E48; <code>InitNoise</code> &#x8FD9;&#x6837;&#x7684;&#x4E8B;&#x4EF6;&#xFF0C;&#x90A3;&#x4E48;&#x8BF7;&#x5F80; <code>ORE_GEN_BUS</code> &#x6216;&#x8005; <code>TERRAIN_GEN_BUS</code> &#x6CE8;&#x518C;&#x3002;</p>
<h2 id="&#x81EA;&#x52A8;&#x6CE8;&#x518C;"><a name="&#x81EA;&#x52A8;&#x6CE8;&#x518C;" class="anchor-navigation-ex-anchor" href="#&#x81EA;&#x52A8;&#x6CE8;&#x518C;"><i class="fa fa-link" aria-hidden="true"></i></a>1.4. &#x81EA;&#x52A8;&#x6CE8;&#x518C;</h2>
<pre><code class="lang-java"><span class="hljs-comment">// &#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#x7684;&#x610F;&#x601D;&#x662F;&#x201C;&#x5C06;&#x8FD9;&#x4E2A;&#x7C7B;&#x6CE8;&#x518C;&#x5230;&#x4E8B;&#x4EF6;&#x603B;&#x7EBF;&#x4E2D;&#x53BB;&#xFF0C;&#x8BE5;&#x4E8B;&#x4EF6;&#x76D1;&#x542C;&#x5668;&#x5C5E;&#x4E8E; my_mod &#x8FD9;&#x4E2A; Mod&#x201D;</span>
<span class="hljs-comment">// &#x5B83;&#x76F8;&#x5F53;&#x4E8E; Forge &#x5E2E;&#x4F60;&#x6267;&#x884C;&#x4E86; MinecraftForge.EVENT_BUS.register(MyFirstEventListener.class)</span>
<span class="hljs-meta">@Mod</span>.EventBusSubscriber(modid = <span class="hljs-string">&quot;example_mod&quot;</span>)
<span class="hljs-keyword">public</span> <span class="hljs-keyword">final</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyFirstEventListener</span> </span>{
    <span class="hljs-meta">@SubscribeEvent</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onEventFired</span><span class="hljs-params">(ACertainEvent event)</span> </span>{

    }
}
</code></pre>
<p>&#x6CE8;&#x610F;&#x90A3;&#x4E2A; <code>static</code>&#x3002;&#x5F53;&#x4E14;&#x4EC5;&#x5F53;&#x4F60;&#x4F7F;&#x7528; <code>EventBusSubscriber</code> &#x6216; <code>class</code> &#x5BF9;&#x8C61;&#x65F6;&#x4F60;&#x9700;&#x8981;&#x5728;&#x65B9;&#x6CD5;&#x4E0A;&#x52A0; <code>static</code>&#x3002;</p>
<p><img src="why-doesnt-my-event-handler-work.png" alt="Courtesy to JamiesWhiteShirt"></p>
<h2 id="&#x4E8B;&#x4EF6;&#x7684;&#x53D6;&#x6D88;&#x4E0E;&#x7ED3;&#x679C;"><a name="&#x4E8B;&#x4EF6;&#x7684;&#x53D6;&#x6D88;&#x4E0E;&#x7ED3;&#x679C;" class="anchor-navigation-ex-anchor" href="#&#x4E8B;&#x4EF6;&#x7684;&#x53D6;&#x6D88;&#x4E0E;&#x7ED3;&#x679C;"><i class="fa fa-link" aria-hidden="true"></i></a>1.5. &#x4E8B;&#x4EF6;&#x7684;&#x53D6;&#x6D88;&#x4E0E;&#x7ED3;&#x679C;</h2>
<p>&#x6CE8;&#x610F;&#x5230;&#x4E8B;&#x4EF6;&#x7684;&#x76D1;&#x542C;&#x5668;&#x4E00;&#x5B9A;&#x662F;&#x4E00;&#x4E2A;&#x8FD4;&#x56DE;&#x503C;&#x4E3A; <code>void</code>&#xFF08;&#x5373;&#x65E0;&#x8FD4;&#x56DE;&#x503C;&#xFF09;&#x7684;&#x65B9;&#x6CD5;&#x3002;&#x5982;&#x679C;&#x6211;&#x8981;&#x8868;&#x8FBE;&#x67D0;&#x79CD;&#x7C7B;&#x4F3C;&#x8FD4;&#x56DE;&#x503C;&#x7684;&#x6982;&#x5FF5;&#x8BE5;&#x600E;&#x4E48;&#x505A;&#xFF0C;&#x6BD4;&#x5982;&#x8BF4;&#x201C;&#x6211;&#x901A;&#x8FC7;&#x67D0;&#x4E2A;&#x4E8B;&#x4EF6;&#x6765;&#x63A7;&#x5236;&#x662F;&#x5426;&#x6267;&#x884C;&#x67D0;&#x4E00;&#x6BB5;&#x4EE3;&#x7801;&#x201D;&#xFF1F;<br>&#x4E8B;&#x4EF6;&#x603B;&#x7EBF;&#x7ED9;&#x51FA;&#x7684;&#x7B54;&#x6848;&#x662F;&#xFF1A;<code>@Cancelable</code> &#x548C; <code>@HasResult</code>&#x3002;  </p>
<p><code>@Cancelable</code> &#x7528;&#x4E8E;&#x63A7;&#x5236;&#x5269;&#x4F59;&#x7684;&#x4E8B;&#x4EF6;&#x76D1;&#x542C;&#x5668;&#x3002;&#x4E8B;&#x4EF6;&#x88AB;&#x53D6;&#x6D88;&#x540E;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E0D;&#x4F1A;&#x518D;&#x5C06;&#x4E8B;&#x4EF6;&#x4F20;&#x9012;&#x7ED9;&#x4E0B;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#x76D1;&#x542C;&#x5668;&#x3002;&#x662F;&#x7684;&#xFF0C;&#x8FD9;&#x91CC;&#x6709;&#x8D23;&#x4EFB;&#x94FE;&#xFF08;Chain of Responsibilities&#xFF09;&#x7684;&#x5F71;&#x5B50;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-comment">// &#x53EA;&#x6709;&#x5E26; @Cancelable &#x6CE8;&#x89E3;&#x7684;&#x4E8B;&#x4EF6;&#x53EF;&#x4EE5;&#x88AB;&#x53D6;&#x6D88;&#x3002;&#x5C1D;&#x8BD5;&#x53D6;&#x6D88;&#x4E0D;&#x53EF;&#x53D6;&#x6D88;&#x7684;&#x4E8B;&#x4EF6;&#x4F1A;&#x4EA7;&#x751F; UnsupportedOperationException&#x3002;</span>
<span class="hljs-comment">// &#x5B9E;&#x9645;&#x64CD;&#x4F5C;&#x4E2D;&#xFF0C;&#x5E76;&#x4E0D;&#x9700;&#x8981;&#x989D;&#x5916;&#x7684; isCancelable &#x68C0;&#x67E5;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x67E5;&#x9605;&#x5BF9;&#x5E94;&#x4E8B;&#x4EF6;&#x7684; JavaDoc &#x7684;&#x8BF4;&#x660E;&#x5373;&#x53EF;&#x3002;</span>
<span class="hljs-keyword">if</span> (event.isCancelable() &amp;&amp; !event.isCanceled()) {
    event.setCanceled(<span class="hljs-keyword">true</span>);
}
</code></pre>
<p><code>@HasResult</code> &#x7528;&#x4E8E;&#x5B9A;&#x4E49;&#x4E8B;&#x4EF6;&#x62E5;&#x6709;&#x4E00;&#x4E2A;&#x201C;&#x7ED3;&#x679C;&#x201D;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-keyword">if</span> (event.hasResult()) {
    Event.Result result = event.getResult();
    <span class="hljs-comment">// &#x4E8B;&#x4EF6;&#x7ED3;&#x679C;&#x6709;&#x4E09;&#x79CD;&#x53EF;&#x80FD;&#x6027;&#xFF1A;DEFAULT&#x3001;ALLOW &#x548C; DENY&#x3002;&#x5176;&#x5177;&#x4F53;&#x542B;&#x4E49;&#x53D6;&#x51B3;&#x4E8E;&#x5177;&#x4F53;&#x7684;&#x4E8B;&#x4EF6;&#x3002;</span>
    event.setResult(Event.Result.DEFAULT);
}
</code></pre>
<p>&#x4E00;&#x822C;&#x7684;&#x8D23;&#x4EFB;&#x94FE;&#x6A21;&#x5F0F;&#x4E2D;&#xFF0C;handler &#x4F1A;&#x5728;&#x80FD;&#x5904;&#x7406;&#x8BF7;&#x6C42;&#x65F6;&#x505C;&#x6B62;&#x5C06;&#x8BF7;&#x6C42;&#x4F20;&#x9012;&#x7ED9;&#x4E0B;&#x4E00;&#x4E2A; handler&#x3002;<!-- TODO This is actually quoted from "Design Patterns: Elements of Reusable Object-Oriented Software", and thus we need proper citation -->&#x5BF9;&#x5E94;&#x5230;&#x4E8B;&#x4EF6;&#x603B;&#x7EBF;&#x7CFB;&#x7EDF;&#x4E2D;&#xFF0C;&#x4FBF;&#x662F; <code>setCanceled(true)</code>&#x3002;&#x5BF9;&#x4E8E;&#x4E0D;&#x53EF;&#x53D6;&#x6D88;&#x7684;&#x4E8B;&#x4EF6;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;&#x5047;&#x5B9A;&#x6240;&#x6709; handler &#x90FD;&#x4E0D;&#x80FD;&#x72EC;&#x81EA;&#x5904;&#x7406;&#x201C;&#x8BF7;&#x6C42;&#x201D;&#xFF08;&#x5373;&#x4E8B;&#x4EF6;&#xFF09;&#x3002;&#x4F46;&#x5B9E;&#x9645;&#x4E0A;&#xFF0C;&#x51FA;&#x4E8E;&#x67D0;&#x79CD;&#x8003;&#x8651;<!-- TODO Concerning about what? -->&#xFF0C;&#x4F60;&#x53EF;&#x4EE5;&#x9009;&#x62E9;&#x63A5;&#x6536;&#x88AB;&#x53D6;&#x6D88;&#x7684;&#x4E8B;&#x4EF6;&#x2014;&#x2014;</p>
<pre><code class="lang-java"><span class="hljs-meta">@SubscribeEvent</span>(receiveCanceled = <span class="hljs-keyword">true</span>)
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onEventFired</span><span class="hljs-params">(ARandomEvent event)</span> </span>{

}
</code></pre>
<h2 id="&#x4F18;&#x5148;&#x7EA7;"><a name="&#x4F18;&#x5148;&#x7EA7;" class="anchor-navigation-ex-anchor" href="#&#x4F18;&#x5148;&#x7EA7;"><i class="fa fa-link" aria-hidden="true"></i></a>1.6. &#x4F18;&#x5148;&#x7EA7;</h2>
<p>&#x5F88;&#x660E;&#x663E;&#xFF0C;&#x540C;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#x53EF;&#x4EE5;&#x6709;&#x597D;&#x51E0;&#x4E2A;&#x76D1;&#x542C;&#x5668;&#x5728;&#x76D1;&#x542C;&#x3002;&#x8FD9;&#x4E9B;&#x76D1;&#x542C;&#x5668;&#x6700;&#x7EC8;&#x90FD;&#x4F1A;&#x6536;&#x5230;&#x76EE;&#x6807;&#x4E8B;&#x4EF6;&#xFF0C;&#x4F46;&#x8C01;&#x5148;&#x8C01;&#x540E;&#x662F;&#x6CA1;&#x6709;&#x5B9A;&#x4E49;&#x7684;&#x3002;&#x5982;&#x679C;&#x6211;&#x4E00;&#x5B9A;&#x9700;&#x8981;&#x67D0;&#x79CD;&#x786E;&#x5B9A;&#x7684;&#x987A;&#x5E8F;&#x600E;&#x4E48;&#x529E;&#xFF1F;&#x89E3;&#x51B3;&#x65B9;&#x6848;&#x662F;&#x6307;&#x5B9A;&#x4F18;&#x5148;&#x7EA7;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-meta">@SubscribeEvent</span>(priority = EventPriority.HIGHEST)
<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onEventFired</span><span class="hljs-params">(ARandomEvent event)</span> </span>{

}
</code></pre>
<p>&#x4F18;&#x5148;&#x7EA7;&#x6709;&#x4E94;&#x79CD;&#xFF0C;&#x6309;&#x4F18;&#x5148;&#x7EA7;&#x4ECE;&#x9AD8;&#x5230;&#x4F4E;&#x4F9D;&#x6B21;&#x662F;&#xFF1A;<code>HIGHEST</code>&#x3001;<code>HIGH</code>&#x3001;<code>NORMAL</code>&#x3001;<code>LOW</code> &#x548C; <code>LOWEST</code>&#x3002;&#x9ED8;&#x8BA4;&#xFF0C;&#x82E5;&#x4E0D;&#x663E;&#x5F0F;&#x6307;&#x5B9A;&#x4F18;&#x5148;&#x7EA7;&#xFF0C;&#x5219;&#x4F7F;&#x7528; <code>NORMAL</code>&#x3002;</p>
<h2 id="&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6211;&#x9700;&#x8981;&#x7684;&#x4E8B;&#x4EF6;&#x600E;&#x4E48;&#x529E;&#xFF1F;"><a name="&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6211;&#x9700;&#x8981;&#x7684;&#x4E8B;&#x4EF6;&#x600E;&#x4E48;&#x529E;&#xFF1F;" class="anchor-navigation-ex-anchor" href="#&#x5982;&#x679C;&#x6CA1;&#x6709;&#x6211;&#x9700;&#x8981;&#x7684;&#x4E8B;&#x4EF6;&#x600E;&#x4E48;&#x529E;&#xFF1F;"><i class="fa fa-link" aria-hidden="true"></i></a>1.7. &#x5982;&#x679C;&#x6CA1;&#x6709;&#x6211;&#x9700;&#x8981;&#x7684;&#x4E8B;&#x4EF6;&#x600E;&#x4E48;&#x529E;&#xFF1F;</h2>
<p>&#x7136;&#x540E;&#x2014;&#x2014;&#x5982;&#x679C;&#x4F60;&#x80FD;&#x770B;&#x5230;&#x8FD9;&#x91CC;&#xFF1A;&#x5F88;&#x597D;&#xFF0C;&#x4F60;&#x5927;&#x6982;&#x6CA1;&#x627E;&#x5230;&#x4F60;&#x9700;&#x8981;&#x7684;&#x4E8B;&#x4EF6;&#x3002;</p>
<ol>
<li>&#x5982;&#x679C;&#x4F60;&#x7684;&#x4E8B;&#x4EF6;&#x662F;&#x81EA;&#x5DF1;&#x7528;&#x7684;&#xFF0C;&#x8BF7;&#x770B;&#x4E0B;&#x9762;&#x4E00;&#x5C0F;&#x8282;&#x3002;</li>
<li>&#x8BF7;&#x4ED4;&#x7EC6;&#x601D;&#x8003;&#x4F60;&#x7684;&#x9700;&#x6C42;&#x3002;&#x4F60;&#x7684;&#x9700;&#x6C42;&#x662F;&#x4E0D;&#x662F;&#x548C;&#x539F;&#x7248;&#x7684;&#x4EC0;&#x4E48;&#x4E1C;&#x897F;&#x6BD4;&#x8F83;&#x50CF;&#xFF1F;&#x539F;&#x7248;&#x7684;&#x4E1C;&#x897F;&#x662F;&#x600E;&#x4E48;&#x505A;&#x7684;&#xFF1F;</li>
<li>&#x518D;&#x4ED4;&#x7EC6;&#x601D;&#x8003;&#x4F60;&#x7684;&#x9700;&#x6C42;&#x3002;&#x4F60;&#x7684;&#x9700;&#x6C42;&#x662F;&#x4E0D;&#x662F;&#x5DF2;&#x7ECF;&#x6709; Mod &#x5B9E;&#x73B0;&#x8FC7;&#x4E86;&#xFF1F;&#x4ED6;&#x4EEC;&#x90FD;&#x662F;&#x5229;&#x7528;&#x4E86;&#x4EC0;&#x4E48;&#x4E8B;&#x4EF6;&#xFF1F;</li>
<li>&#x5426;&#x5219;&#x4F60;&#x53EA;&#x80FD;&#x7ED9; Forge &#x53D1; Pull request &#x4E86;&#x3002;</li>
</ol>
<h2 id="&#x4F46;&#x662F;&#x6211;&#x9700;&#x8981;&#x7ED9;&#x81EA;&#x5DF1;&#x7684;&#x3010;&#x67D0;&#x79CD;&#x673A;&#x5236;&#x3011;&#x5F04;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#xFF01;"><a name="&#x4F46;&#x662F;&#x6211;&#x9700;&#x8981;&#x7ED9;&#x81EA;&#x5DF1;&#x7684;&#x3010;&#x67D0;&#x79CD;&#x673A;&#x5236;&#x3011;&#x5F04;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#xFF01;" class="anchor-navigation-ex-anchor" href="#&#x4F46;&#x662F;&#x6211;&#x9700;&#x8981;&#x7ED9;&#x81EA;&#x5DF1;&#x7684;&#x3010;&#x67D0;&#x79CD;&#x673A;&#x5236;&#x3011;&#x5F04;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#xFF01;"><i class="fa fa-link" aria-hidden="true"></i></a>1.8. &#x4F46;&#x662F;&#x6211;&#x9700;&#x8981;&#x7ED9;&#x81EA;&#x5DF1;&#x7684;&#x3010;&#x67D0;&#x79CD;&#x673A;&#x5236;&#x3011;&#x5F04;&#x4E00;&#x4E2A;&#x4E8B;&#x4EF6;&#xFF01;</h2>
<pre><code class="lang-java"><span class="hljs-comment">// @Cancalable // &#x5141;&#x8BB8;&#x53D6;&#x6D88;&#x7684;&#x4E8B;&#x4EF6;&#x9700;&#x8981;&#x6709;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#x3002;</span>
<span class="hljs-comment">// @HasResult // &#x6709;&#x67D0;&#x79CD;&#x7ED3;&#x679C;&#x7684;&#x4E8B;&#x4EF6;&#x5E94;&#x5F53;&#x6709;&#x8FD9;&#x4E2A;&#x6CE8;&#x89E3;&#x3002;</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyEvent</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">Event</span> </span>{
    <span class="hljs-keyword">public</span> <span class="hljs-keyword">final</span> Object foo;
    <span class="hljs-comment">//&#x6309;&#x7167;&#x60EF;&#x4F8B;&#xFF0C;&#x4E8B;&#x4EF6;&#x4E2D;&#x7684;&#x5B57;&#x6BB5;&#x90FD;&#x5E94;&#x8BE5;&#x662F;Final&#x7684;</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">MyEvent</span><span class="hljs-params">(Object foo)</span> </span>{
        <span class="hljs-keyword">this</span>.foo = foo;
    }
}

<span class="hljs-comment">// &#x53D1;&#x5E03;&#x4E8B;&#x4EF6;&#x3002;</span>
<span class="hljs-comment">// &#x8FD9;&#x4E2A;post&#x662F;&#x6709;&#x8FD4;&#x56DE;&#x503C;&#xFF0C;&#x542B;&#x4E49;&#x5982;&#x4E0B;&#xFF1A;</span>
<span class="hljs-comment">// true &#x4EE3;&#x8868;&#x4E8B;&#x4EF6;&#x88AB;&#x53D6;&#x6D88;&#x3002;&#x4E8B;&#x4EF6;&#x5FC5;&#x987B;&#x6709; @Cancalable &#x6CE8;&#x89E3;&#x624D;&#x53EF;&#x4EE5;&#x88AB;&#x53D6;&#x6D88;&#xFF0C;&#x5E76;&#x6709;&#x53EF;&#x80FD;&#x4EE4; EventBus.post &#x8FD4;&#x56DE; true&#x3002;</span>
<span class="hljs-comment">// false &#x4EE3;&#x8868;&#x4E8B;&#x4EF6;&#x6210;&#x529F;&#x53D1;&#x5E03;&#x3002;&#x6709; @Cancalable &#x7684;&#x4E8B;&#x4EF6;&#xFF0C;&#x4E14;&#x6CA1;&#x6709;&#x88AB;&#x53D6;&#x6D88;&#x65F6;&#x4F1A;&#x8FD4;&#x56DE; false&#x3002;</span>
<span class="hljs-comment">// &#x82E5;&#x8FD9;&#x4E2A;&#x4E8B;&#x4EF6;&#x65E0;&#x6CD5;&#x53D6;&#x6D88;&#xFF0C;&#x4E00;&#x5B9A;&#x4F1A;&#x8FD4;&#x56DE; false&#x3002;</span>
<span class="hljs-keyword">boolean</span> result = MinecraftForge.EVENT_BUS.post(<span class="hljs-keyword">new</span> MyEvent(aFoo));
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../chapter-02/build.html" class="navigation navigation-prev " aria-label="Previous page: 2.2 Mod 的构建与发布">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../chapter-04/" class="navigation navigation-next " aria-label="Next page: 4. 物品">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"3. 事件","level":"3.3","depth":1,"next":{"title":"4. 物品","level":"3.4","depth":1,"path":"chapter-04/index.md","ref":"chapter-04/index.md","articles":[{"title":"4.1 ItemStack","level":"3.4.1","depth":2,"path":"chapter-04/item-stack.md","ref":"chapter-04/item-stack.md","articles":[]},{"title":"4.2 物品进阶","level":"3.4.2","depth":2,"path":"chapter-04/advanced/index.md","ref":"chapter-04/advanced/index.md","articles":[{"title":"4.2.1 Meta-hack","level":"3.4.2.1","depth":3,"path":"chapter-04/advanced/meta-hack.md","ref":"chapter-04/advanced/meta-hack.md","articles":[]},{"title":"4.2.2 食物","level":"3.4.2.2","depth":3,"path":"chapter-04/advanced/food.md","ref":"chapter-04/advanced/food.md","articles":[]},{"title":"4.2.3 工具及武器等","level":"3.4.2.3","depth":3,"path":"chapter-04/advanced/tool.md","ref":"chapter-04/advanced/tool.md","articles":[]},{"title":"4.2.4 护甲","level":"3.4.2.4","depth":3,"path":"chapter-04/advanced/armor.md","ref":"chapter-04/advanced/armor.md","articles":[]},{"title":"4.2.5 投掷物","level":"3.4.2.5","depth":3,"path":"chapter-04/advanced/throwable.md","ref":"chapter-04/advanced/throwable.md","articles":[]}]}]},"previous":{"title":"2.2 Mod 的构建与发布","level":"3.2.2","depth":2,"path":"chapter-02/build.md","ref":"chapter-02/build.md","articles":[]},"dir":"ltr"},"config":{"plugins":["katex","splitter","expandable-chapters","anchor-navigation-ex","heimu"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"splitter":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"flow":{"line-color":"red"},"katex":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"heimu":{"keyword":"black","title":""},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"https://github.com/TeamCovertDragon/Harbinger/graphs/contributors","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Harbinger","links":{"sidebar":{"TeamCovertDragon":"https://covertdragon.team/"}},"gitbook":"*","description":"Just Another FMLTutor For Future"},"file":{"path":"chapter-03/index.md","mtime":"2019-08-01T10:46:04.494Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-08-01T13:08:27.073Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

